home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-03
/
dosbas.zip
/
BEEPER.ASM
< prev
next >
Wrap
Assembly Source File
|
1990-12-19
|
2KB
|
63 lines
;«RM82»«TS8,16,24,32,40,48»
;=========================================================================
; Copyright (C) Copr. 1990 by Sidney J. Kelly
; All Rights Reserved.
; Sidney J. Kelly
; 150 Woodhaven Drive
; Pittsburgh, PA 15228
; home phone 412-561-0950 (7pm to 9:30pm EST)
;
; Updated 9/20/90
;=========================================================================
;=========================================================================
; DECLARE SUB BEEPER
; BEEPER
; Primarily used to show you how to make sound in a somewhat machine
; independent basis
;=========================================================================
DOSSEG
.model medium
.code
public BEEPER
; Please do not remove
Copyright DB 13,10,'Copyright Copr. (C) 1990 Sidney J. Kelly',13,10
Copyright1 DB 'All Rights Reserved',13,10,26
EVEN
BEEPER PROC FAR
Pushf
Mov DX,03000h ; default delay for AT & above
Xor AX,AX ; clear AX
Push AX ; put on stack
Popf ; put in flags
Pushf ; put back on stack
Pop AX ; get flags back in AX
And AX,0F000h ; clear all but upper 4 bits
Cmp AX,0F000h ; if bits 12-15 are set then CPU
JNE @f ; is not an 80286, 80386 or 80486
Mov DX,02000h ; delay for a PC/XT
@@:
In AL,61h ; save old speaker setting
Push AX
Mov AL,0 ; set speaker frequency
Out 42h,AL ; low byte
Mov AL,5 ; lower this number for higher frequency
Jmp $+2 ; AT & above delay
Out 42h,AL ; high byte
Pop AX ; old speaker setting
Push AX ; save again
Or AL,3 ; turn on speaker
Out 61h,AL
Mov CX,DX ; the delay factor
waitloop:
Loop waitloop
Pop AX ; turn off speaker
Out 61h,AL
Popf
Ret
BEEPER ENDP
end